/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nxlv2.nomad.businessobjects;

import java.util.ArrayList;
import java.util.Date;
import org.joda.time.DateTime;

/**
 *
 * @author Xavier
 */
public class Demande {

    private int idBase, idAppli, valideDemande, idAdresseFacturation, idAdresseLivraison;
    private long numDemande;
    private Date date;
    private TypeDemande typeDemande;
    private ArrayList<DetailDemande> listDetailDemande;

    public Demande() {
    }

    /**
     *
     * @param idBase
     * @param idAppli
     * @param date
     * @param typeDemande
     * @param listDetailDemande
     */
    public Demande(int idBase, int idAppli, long numDemande, int valideDemande, int idAdresseFacturation, int idAdresseLivraison, Date date, TypeDemande typeDemande,
            ArrayList<DetailDemande> listDetailDemande) {
        this.idBase = idBase;
        this.idAppli = idAppli;
        this.numDemande = numDemande;
        this.valideDemande = valideDemande;
        this.idAdresseFacturation = idAdresseFacturation;
        this.idAdresseLivraison = idAdresseLivraison;
        this.date = date;
        this.typeDemande = typeDemande;
        this.listDetailDemande = listDetailDemande;
    }

    public Demande(int idBase, int idAppli, Date date, TypeDemande typeDemande, ArrayList<DetailDemande> listDetailDemande) {
        this.idBase = idBase;
        this.idAppli = idAppli;
        this.date = date;
        this.typeDemande = typeDemande;
        this.listDetailDemande = listDetailDemande;
    }

    /**
     *
     * @param idBase
     * @param idAppli
     * @param date
     * @param typeDemande
     */
    public Demande(int idBase, int idAppli, int numDemande, Date date, TypeDemande typeDemande) {
        this.idBase = idBase;
        this.idAppli = idAppli;
        this.date = date;
        this.typeDemande = typeDemande;
    }

    public Demande(int idBase, int idAppli, Date date, TypeDemande typeDemande) {
        this.idBase = idBase;
        this.idAppli = idAppli;
        this.date = date;
        this.typeDemande = typeDemande;
    }

    /**
     *
     * @return idBase
     */
    public int getIdBase() {
        return idBase;
    }

    /**
     *
     * @param idBase
     */
    public void setIdBase(int idBase) {
        this.idBase = idBase;
    }

    /**
     *
     * @return idAppli
     */
    public int getIdAppli() {
        return idAppli;
    }

    /**
     *
     * @param idAppli
     */
    public void setIdAppli(int idAppli) {
        this.idAppli = idAppli;
    }

    /**
     *
     * @return date
     */
    public Date getDate() {
        return date;
    }

    /**
     *
     * @return numDemande
     */
    public long getNumDemande() {
        return numDemande;
    }

    /**
     *
     * @return valideDemande
     */
    public int getValideDemande() {
        return valideDemande;
    }

    /**
     *
     * @param valideDemande
     */
    public void setValideDemande(int valideDemande) {
        this.valideDemande = valideDemande;
    }

    /**
     *
     * @param numDemande
     */
    public void setNumDemande(long numDemande) {
        this.numDemande = numDemande;
    }

    /**
     *
     * @param date
     */
    public void setDate(Date date) {
        this.date = date;
    }

    /**
     *
     * @return typeDemande
     */
    public TypeDemande getTypeDemande() {
        return typeDemande;
    }

    /**
     *
     * @param typeDemande
     */
    public void setTypeDemande(TypeDemande typeDemande) {
        this.typeDemande = typeDemande;
    }

    /**
     *
     * @return listDetailDemande
     */
    public ArrayList<DetailDemande> getListDetailDemande() {
        return listDetailDemande;
    }

    /**
     *
     * @param listDetailDemande
     */
    public void setListDetailDemande(ArrayList<DetailDemande> listDetailDemande) {
        this.listDetailDemande = listDetailDemande;
    }

    /**
     *
     * @return idAdresseFacturation
     */
    public int getIdAdresseFacturation() {
        return idAdresseFacturation;
    }

    /**
     *
     * @param idAdresseFacturation
     */
    public void setIdAdresseFacturation(int idAdresseFacturation) {
        this.idAdresseFacturation = idAdresseFacturation;
    }

    /**
     *
     * @return idAdresseLivraison
     */
    public int getIdAdresseLivraison() {
        return idAdresseLivraison;
    }

    /**
     *
     * @param idAdresseLivraison
     */
    public void setIdAdresseLivraison(int idAdresseLivraison) {
        this.idAdresseLivraison = idAdresseLivraison;
    }

    /**
     *
     * @return String
     */
    @Override
    public String toString() {
//        return "Demande{" + "idBase=" + idBase + ", idAppli=" + idAppli + ", date=" + date + ", numDemande=" + numDemande +", typeDemande=" + typeDemande + ", listDetailDemande=" + listDetailDemande + '}';
//        return "" + date;
        return new DateTime(date).toString("dd/MM/YYYY");
    }
    
    public String toJSONString(){
        return "{\"idBase\":\""+ idBase +"\",\"idAppli\":\""+ idAppli +"\",\"date\":\""+ date +"\",\"numDemande\":\""+ numDemande +"\",\"typeDemande\":\""+ typeDemande.getId() +"\",\"valideDemande\":\""+ valideDemande +"\",\"idAdresseFacturation\":\""+ idAdresseFacturation +"\",\"idAdresseLivraison\":\""+ idAdresseLivraison +"\"}";
    }
}
